package com.ruoyi.mes.domain;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;


/**
 * Tree树结构实体类
 * 
 * @author ruoyi
 */
public class ProcessTree implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private String id;

    /** 节点名称 */
    private String label;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<ProcessTree> children;


    public ProcessTree(MesProcess mesProcess)
    {
        this.id = mesProcess.getProcessUuid();
        this.label = mesProcess.getItemName()+'-'+mesProcess.getPartNum();
        this.children = mesProcess.getChildren().stream().map(ProcessTree::new).collect(Collectors.toList());
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLabel()
    {
        return label;
    }

    public void setLabel(String label)
    {
        this.label = label;
    }



    public List<ProcessTree> getChildren()
    {
        return children;
    }

    public void setChildren(List<ProcessTree> children)
    {
        this.children = children;
    }
}
